﻿

var status = -1;
var beauty = 0;
var hair_Colo_new;

function start() {
	action(1, 0, 0);
}

function action(mode, type, selection) {
	if (mode == 0) {
		cm.dispose();
		return;
	} else {
		status++;
	}
	if (status == 0) {
		cm.sendSimple("这里是整形医院，只要你有#v2430865#，你就把头发交给我吧。选择你想做的事情吧。\r\n#b#L0#更换发型(VIP特权)#l\r\n#L1#染色(VIP特权)#l");
	} else if (status == 1) {
		if (selection == 0) { //更换发型
			var hair = cm.getPlayerStat("HAIR");
			hair_Colo_new = [];
			beauty = 1;
			if (cm.getPlayerStat("GENDER") == 0) { //男生
				hair_Colo_new = [30000, 30010, 30020, 30030, 30040, 30050, 30060, 30070, 30080, 30090, 30100, 30110, 30120, 30130, 30140, 30150, 30160, 30170, 30180, 30190, 30200, 30210, 30220, 30230, 30240, 30250, 30260, 30270, 30280, 30290, 30300, 30310, 30320, 30330, 30340, 30350, 30360, 30370, 30380, 30400, 30410, 30420, 30430, 30440, 30450, 30460, 30470, 30480, 30490, 30510, 30520, 30530, 30540, 30550, 30560, 30570, 30590, 30600, 30610, 30620, 30630, 30640, 30650, 30660, 30670, 30680, 30700, 30710, 30720, 30730, 30740, 30750, 30760, 30770, 30780, 30790, 30800, 30810, 30820, 30830, 30840, 30850, 30860, 30870, 30880, 30890, 30900, 30910, 30920, 30930, 30940, 30950, 30990, 33000, 33030, 33040, 33050, 33060, 33070, 33080, 33090, 33100, 33110, 33120, 33130, 33140, 33150, 33160, 33170, 33180, 33190, 33200, 33210, 33220, 33230, 33240, 33250, 33260, 33270, 33280, 33290, 33300, 33310, 33320, 33330, 33340, 33350, 33360, 33370, 33380, 33390, 33400, 33410, 33430, 33440, 33450, 33460, 33470, 33480, 33500, 33510, 33520, 33530, 33540, 33550, 33580, 33590, 33600, 33610, 33620, 33630, 33640, 33650, 33660, 33670, 33680, 33690, 33700, 33710, 33720, 33730, 33740, 33750, 33760, 33770, 33780, 33790, 33800, 33810, 33820, 33830, 33930, 33940, 33950, 33960, 33970, 33980, 33990, 35000, 35010, 35020, 35030, 35040, 35050, 35060, 35070, 35080, 35090, 35100, 35110, 35120, 35130, 35150, 35160, 35170, 35180, 35190, 35200, 35210, 35220, 35230, 35240, 35250, 35260, 35270, 35280, 35290, 35300, 35310, 35330, 35340, 35350, 35360, 35400, 35410, 35420, 35430, 35440, 35450, 35460, 35470, 35480, 35490, 35500, 35510, 35520, 35530, 35540, 35550, 35560, 35570, 35600, 35620, 35630, 35640, 35650, 35660, 35680, 35690, 35700, 35710, 35720, 35730, 35750, 35760, 35770, 35780, 35790, 35800, 35820, 35830, 36000, 36010, 36020, 36030, 36040, 36050, 36070, 36080, 36090, 36100, 36110, 36120, 36130, 36140, 36150, 36160, 36170, 36180, 36190, 36200, 36210, 36220, 36230, 36240, 36250, 36260, 36280, 36290, 36300, 36310, 36320, 36330, 36340, 36350, 36360, 36370, 36380, 36390, 36400, 36410, 36420, 36430, 36440, 36450, 36460, 36470, 36480, 36490, 36510, 36520, 36530, 36540, 36550, 36560, 36570, 36580, 36590, 36600, 36620, 36630, 36640, 36650, 36670, 36680, 36690, 36700, 36710, 36720, 36730, 36740, 36750, 36760, 36770, 36780, 36790, 36800, 36810, 36820, 36830, 36840, 36850, 36860, 36880, 36890, 36900, 36910, 36920, 36930, 36940, 36950, 36980, 36990];
			} else {
				hair_Colo_new = [32500, 37020, 31060, 34560, 31890, 31610, 34330, 34880, 34860, 31770, 34890, 37580, 34770, 37310, 37410, 34640, 34650, 31250, 34900, 31930, 34060, 37420, 37050, 34750, 34040, 34310, 33680, 34510, 37190, 31540, 34430, 37720, 34850, 34470, 34970, 31640, 37180, 34840, 34670, 31710, 37060, 31760, 37090, 34260, 37200, 34870, 37380, 37010, 34480, 37230, 34630, 34610, 37300, 34780, 37510, 31940, 31180, 34790, 37530, 37610, 34450, 34410, 37540, 31900, 34250, 34230, 37320, 37550, 34950, 34400, 37210, 37250, 37460, 32140, 34180, 34210, 34220, 37000, 37760, 37340, 37280, 34590, 34600, 34730, 34800, 34960, 34810, 37560, 31990, 34720, 36400, 34990, 37030, 34940, 37440, 37520, 37680, 34710, 31130, 37700, 37290, 37920, 37860, 38070, 37900, 37830, 37630, 37950, 37690, 37810, 37880, 37890, 37710, 38240, 38150, 37980, 37970, 37820, 34840, 37350, 34950, 38220, 37640, 38020];
			}
			for (var i = 0; i < hair_Colo_new.length; i++) {
				hair_Colo_new[i] = hair_Colo_new[i] + (hair % 10);
			}
			cm.askAvatar("我可以帮你换成全新的发型。你厌倦了现在的发型了吗？只要你有#v2433291#，我就可以帮你更换发型。请慢慢挑选自己喜欢的发型～", hair_Colo_new, 2433291, false);
		} else if (selection == 1) {
			var currenthaircolo = Math.floor((cm.getPlayerStat("HAIR") / 10)) * 10;
			hair_Colo_new = [];
			beauty = 2;
			for (var i = 0; i < 8; i++) {
				hair_Colo_new[i] = currenthaircolo + i;
			}
			cm.askAvatar("我们可以为你改变头发的颜色。是不是已经厌倦了头发的颜色啊？只要你有#v2433291#，现在为你染发，慢慢挑选你喜欢的颜色吧！", hair_Colo_new, 2433291, false);
		}
	} else if (status == 2) {
		if (beauty == 1) {
			if (cm.getPlayer().getCSPoints(1) <= 1) {
				cm.sendOk("你没有点卷，我无法给你换发型.");

			} else if (cm.setAvatar(2433291, hair_Colo_new[selection]) == 1) {
				cm.gainNX(-1);
				cm.sendOk("理发好了，怎么样？看看你的新发型吧！");
			} else {
				cm.sendOk("尊敬的VIP特权用户？不好意思，如果您没有#v2433291#的话，我就不能帮你理发。");
			}
		} else {
			if (cm.setAvatar(2433291, hair_Colo_new[selection]) == 1) {
				cm.sendOk("好了，让朋友们赞叹你的新发色吧！");
			} else {
				cm.sendOk("尊敬的VIP特权用户？不好意思，如果您没有#v2433291#的话，我就不能帮你染发。");
			}
		}
		cm.dispose();
	}
}
